home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / changemode.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  93 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: changemode.c,v 1.2 1996/10/24 15:50:24 aros Exp $
  4.     $Log: changemode.c,v $
  5.     Revision 1.2  1996/10/24 15:50:24  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.1  1996/09/11 12:54:45  digulla
  9.     A couple of new DOS functions from M. Fleischer
  10.  
  11.     Desc:
  12.     Lang: english
  13. */
  14. #include <clib/exec_protos.h>
  15. #include <dos/dosextens.h>
  16. #include <dos/filesystem.h>
  17. #include "dos_intern.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <clib/dos_protos.h>
  23.  
  24.     AROS_LH3(BOOL, ChangeMode,
  25.  
  26. /*  SYNOPSIS */
  27.     AROS_LHA(ULONG, type,    D1),
  28.     AROS_LHA(BPTR,  object,  D2),
  29.     AROS_LHA(ULONG, newmode, D3),
  30.  
  31. /*  LOCATION */
  32.     struct DosLibrary *, DOSBase, 75, Dos)
  33.  
  34. /*  FUNCTION
  35.     Try to change the mode used by a lock or filehandle.
  36.  
  37.     INPUTS
  38.     type    - CHANGE_FH or CHANGE_LOCK.
  39.     object  - Filehandle or lock.
  40.     newmode - New mode.
  41.  
  42.     RESULT
  43.     !=0 if all went well, 0 else. IoErr() gives additional information
  44.     in that case.
  45.  
  46.     NOTES
  47.     Since filehandles and locks are identical under AROS the type
  48.     argument is ignored.
  49.  
  50.     EXAMPLE
  51.  
  52.     BUGS
  53.  
  54.     SEE ALSO
  55.  
  56.     INTERNALS
  57.  
  58.     HISTORY
  59.     29-10-95    digulla automatically created from
  60.                 dos_lib.fd and clib/dos_protos.h
  61.  
  62. *****************************************************************************/
  63. {
  64.     AROS_LIBFUNC_INIT
  65.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  66.  
  67.     /* Get pointer to filehandle */
  68.     struct FileHandle *fh=(struct FileHandle *)BADDR(object);
  69.  
  70.     /* Get pointer to process structure */
  71.     struct Process *me=(struct Process *)FindTask(NULL);
  72.  
  73.     /* Get pointer to I/O request. Use stackspace for now. */
  74.     struct IOFileSys io,*iofs=&io;
  75.  
  76.     /* Prepare I/O request. */
  77.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  78.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  79.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  80.     iofs->IOFS.io_Device =fh->fh_Device;
  81.     iofs->IOFS.io_Unit   =fh->fh_Unit;
  82.     iofs->IOFS.io_Command=FSA_FILE_MODE;
  83.     iofs->IOFS.io_Flags  =0;
  84.     iofs->io_Args[0]=newmode;
  85.  
  86.     /* Send the request. */
  87.     DoIO(&iofs->IOFS);
  88.     
  89.     /* Set error code and return */
  90.     return (me->pr_Result2=iofs->io_DosError)==0;
  91.     AROS_LIBFUNC_EXIT
  92. } /* ChangeMode */
  93.